/*
 * 
 * 
 * 
 */
package com.cms.controller.admin;

import com.cms.domain.Feedback;
import com.cms.entity.Web;
import com.cms.service.WebService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;


/**
 * Controller - 网站信息
 * 
 * 
 * 
 */
@Controller("adminWebController")
@RequestMapping("/admin/web")
public class WebController extends BaseController {

	@Autowired
	private WebService webService;
	
	/**
	 * 编辑
	 */
	@RequestMapping
	public String index(ModelMap modelMap){
		Web web = webService.findBySiteId(getCurrentSite().getId());
		modelMap.addAttribute("web", web);
		return getView("web/index");
	}
	
	/**
	 * 修改
	 */
	@ResponseBody
	@RequestMapping("/update")
	public Feedback update(Web web){
		webService.updateById(web);
		return Feedback.success(new HashMap<>());
	}
	
}
